package com.datasource.util;

import java.util.Random;

public final class CharUtil {
  private static final char[] chars = new char[52];
  private static final Random random = new Random(47);

  static {
    for (int i = 0; i < 26; i++) {
      chars[i] = (char) (i + 65);
    }

    for (int i = 26; i < 52; i++) {
      chars[i] = (char) (i + 71);
    }
  }

  public static String[] getRandomStrings(int counts, int minLength, int maxLength) {
    String[] results = new String[counts];
    for (int i = 0; i < counts; i++) {
      int length = RandomUtil.randomLength(minLength, maxLength);
      StringBuilder builder = new StringBuilder();
      for (int j = 0; j < length; j++) {
        builder.append(chars[random.nextInt(chars.length)]);
      }

      results[i] = builder.toString();
    }

    return results;
  }

  static void print() {
    System.out.println(chars);
  }
}
